import time

from selenium import webdriver
import pytest,logging,json
from zhokao3.Page import Page
from zhokao3.Page1 import Page
def aa():
    with open('min.json','r',encoding='utf8')as f:
        return json.load(f)
a=aa()
@pytest.fixture()
def dr():
    dr=webdriver.Edge()
    logging.error('用例执行前执行')
    dr.maximize_window()
    yield dr
    logging.error('用例执行后执行')
    dr.quit()
@pytest.mark.parametrize('data',a)
def test_001(dr,data):
    try:
        a = Page(dr)
        a.cz(data['zh'], data['mm'])
        logging.error('用例执行时执行')
    except Exception as e:
        t=time.strftime('%Y%m%d%H%M%S')
        dr.save_screenshot(t+'.png')
        print(e)
def test_002(dr):
    try:
        a = Page(dr)
        a.cz()
        logging.error('用例执行时执行')
    except Exception as e:
        t=time.strftime('%Y%m%d%H%M%S')
        dr.save_screenshot(t+'.png')
        print(e)